/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import javax.swing.JLabel;
import javax.swing.JTextField;
import model.CD;
import model.Document;

/**
 *
 * @author Ira
 */
public class DocumentPropertiesCD extends DocumentPropertiesField {
	
	private JLabel lblLenght = new JLabel("Durée");
	private JTextField txtLenght = new JTextField(13);
	private JLabel lblType = new JLabel("Type de musique");
	private JTextField txtType = new JTextField(13);
	
	public DocumentPropertiesCD(boolean editable) {
		super(editable);
		
		this.txtLenght.setEditable(editable);
		this.txtType.setEditable(editable);
		this.add(this.lblLenght, "w 60!");
		this.add(this.txtLenght);
		this.add(this.lblType, "w 60!");
		this.add(this.txtType);
	}

	@Override
	public void setContent(Document d) {
		this.txtLenght.setText("" + ((CD)d).getLenght());
		this.txtType.setText(((CD)d).getType());
	}

	@Override
	public void getContent(Document d) {
		CD cd = (CD)d;
		cd.setLenght(Integer.parseInt(this.txtLenght.getText()));
		cd.setType(this.txtType.getText());
	}

	/**
	 * @return the txtLenght
	 */
	public String getTxtLenght() {
		return txtLenght.getText();
	}

	/**
	 * @return the txtType
	 */
	public String getTxtType() {
		return txtType.getText();
	}
	
}
